﻿<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="kiben" content="no-cache" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="shortcut icon" href=" /favicon.ico" />
    <title>校园支付 - 用户中心</title>
    <link href="css/main.css" rel="stylesheet" type="text/css" media="all" />
    <link href="css/dialog.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery.1.6.2_mini.js" type="text/javascript"></script>
    <script src="js/dialog.js" type="text/javascript"></script>
    <script src="js/common.js" type="text/javascript"></script>
    <script src="js/service.js" type="text/javascript"></script>
    <script type="text/javascript">
        var ShowLossBox = false;

        $(function () {
            $('#txt_CardPassword').val('输入一卡通密码进行挂失').bind({
                'focus': function () {
                    var _this = $(this);
                    var realPass = $('<input />')
                    .attr({ 'class': 'act', 'name': 'cardPassword', 'id': 'cardPassword', 'type': 'password', 'maxlength': 16 })
                    .val('')
                    .blur(function () {
                        if (!$(this).val()) {
                            $(this).remove();
                            _this.show();
                        }
                    });
                    $(this).hide().before(realPass);
                    realPass[0].focus();
                },
                'blur': function () {
                    var tmpVal = $(this).val();
                    if (!tmpVal || tmpVal == defaultValue) {
                        $(this).val(defaultValue).removeClass('act');
                    }
                }
            });

            $('label.status').click(function () {
                if (ShowLossBox) {
                    $('#div_LossCard').hide();
                    ShowLossBox = false;
                }
                else {
                    $('#div_LossCard').show();
                    ShowLossBox = true;
                }
            });

            $('#btn_LossCard').click(LossMyCard);

            $('input:[type=radio][name=radio_PayType]').each(function () {
                var _this = $(this);
                $(this).mousedown(function () {
                    if ($(this).attr('checked')) {
                        window.setTimeout(function () { _this.attr('checked', false); }, 100);
                    }
                });
            });

            $('.radioBox > label').each(function () {
                var _radio = $(this).prev();
                $(this).click(function () {
                    if (_radio.attr('checked')) {
                        window.setTimeout(function () { _radio.attr('checked', false); }, 100);
                    }
                });
            });

            $('#btn_SubmitPay').click(function () {
                var _payVal = $('#txt_PayValue').val();
                if (0 == _payVal) {
                    Alert('请选择充值金额！');
                    return;
                }

                var payWithOther = $('input:[type=radio][name=radio_PayType]:checked').length > 0;
                if (!payWithOther) {
                    //自己给自己充值
                    //Alert('自己给自己充值，这里后续该如何操作？');
                    AddItemToCart({ 'ItemName': '一卡通充值', 'ItemPrice': parseFloat(_payVal), 'ItemId': 0 }, null, 0);
                } else {
                    var t = parseInt($('input:[type=radio][name=radio_PayType]:checked').attr('value'), 10);
                    if (1 == t) {
                        //找人给自己充
                        window.open('qing.html?payval=' + _payVal);
                    } else {
                        //帮别人冲
                        window.open('bang.page?payval=' + _payVal);
                    }
                }
            });

            $('.billTabBox > a').each(function (idx) {
                $(this).mouseover(function () {
                    $('.billTabBox > .actived').removeClass('actived');
                    $(this).addClass('actived');
                    $('#div_billListBox > ul').hide();
                    $($('#div_billListBox > ul').get(idx)).show();
                });
            });

            $('#radio_Bank_0, #lb_Bank_0').click(function () {
                $('#sp_BankSaveMoney').html(0).hide();
                $('#sp_BankSaveUnit, #sp_BankSaveTxt').hide();
            });
            
            $('#btn_SubmitBank').click(function () {
                var _payVal = $('#sp_CartItemMoney').html();
                if (0 == _payVal) {
                	Alert('请先选择充值或缴费项目！');
                    return;
                }

                var orderBank = $("input[name='radio_Bank']:checked").val();
                if (typeof(orderBank) == 'undefined') {
                    orderBank = $("#sel_OtherBank").val();
                }
                if (orderBank == '') {
                    Alert('请选择支付银行!');
                    return;
                }
                
                /*$.post("upsafe.action", { method: 'checkPayLimit', orderDetails: feeItems.join(',') },
					function(data, status) {
					    if (data == 'false') {
					        Alert("该缴费项目已经停止缴费，请选择其他的缴费项目！");
					    } else {
					        var infoHTML = '<div style="width:96%; line-height:30px; text-align:left;">';
					        infoHTML += '<span style="color:#333; font-size:16px; font-weight:bold;">充值遇到问题？</span><br />';
                            infoHTML += '<hr style="height:1px;border:none;border-top:1px solid #666;" />';
                            infoHTML += '<span style="color:#666; font-size:12px;">充值完成前请不要关闭本窗口，充值完成后请根据情况选择以下按钮：</span><br />';
                            infoHTML += '<span style="color:#333; font-size:12px; font-weight:bold;">请在新打开的储蓄卡支付页面完成付款后再选择</span>';
                            infoHTML += '<div>';
                            Confirm(infoHTML, { Txt_OK: '完成充值', Txt_Cancel: '充值帮助', CallBack_OK: function () { window.location.reload(); }, CallBack_Cancel: function () { window.open('help.html'); } });

                            var orderDetails = feeItems.join(',');
                
                            $('#orderName').val('缴费');
                            $('#orderInfo').val('自己给自己缴费');
                            $('#orderDetails').val(orderDetails);
                            $('#orderPrice').val(_payVal);
                            $('#orderBank').val(orderBank);
                            $('#payForm').submit();
					    }
					}
				)*/
				
				var infoHTML = '<div style="width:96%; line-height:30px; text-align:left;">';
				infoHTML += '<span style="color:#333; font-size:16px; font-weight:bold;">支付遇到问题？</span><br />';
                infoHTML += '<hr style="height:1px;border:none;border-top:1px solid #666;" />';
                infoHTML += '<span style="color:#666; font-size:12px;">支付完成前请不要关闭本窗口，支付完成后请根据情况选择以下按钮：</span><br />';
                infoHTML += '<span style="color:#333; font-size:12px; font-weight:bold;">请在新打开的储蓄卡支付页面完成付款后再选择</span>';
                infoHTML += '<div>';
                Confirm(infoHTML, { Txt_OK: '完成支付', Txt_Cancel: '支付失败', CallBack_OK: function () { window.location.reload(); }, CallBack_Cancel: function () { window.location.reload(); /*window.open('help.html');*/ } });

                var orderDetails = feeItems.join(',');
                
                $('#orderName').val('缴费');
                $('#orderInfo').val('自己给自己缴费');
                $('#orderDetails').val(orderDetails);
                $('#orderPrice').val(_payVal);
                $('#orderBank').val(orderBank);
                $('#payForm').submit();
            });
            
            $('#sel_OtherBank').change(function() {
            	//$("#radio_Bank_0").attr("checked","checked");
			});
            

            //获取当前登录用户信息
            //GetCurrentUserBaseInfo();
            GetCurrentUserExtInfo();
            //未读消息
            //GetNewMessages();
            //一卡通基本信息
            GetMyCardInfo();
            //获取充值卡面额列表
            GetPaidCards();
            //获取交费项目
            GetPayForItems();
            //获取历史交易记录
            GetBillHistoryList();
            //获取银行信息
            GetBanks();
        });
    </script>
</head>
<body>
    <!--头部区域-->
    <div id="header">
        <!-- <a href="help.html" target="_blank" title="帮助"></a> -->
        <a href="quit.action" title="退出"></a>
    </div>
    <!--用户信息区域-->
    <div id="userBlock">
        <!--用户头像-->
        <div class="headIconBox">
            <img id="img_UserIcon" src="<s:property value="userIcon"/>" alt="用户头像" />
            <p title="点击更改头像"></p>
        </div>
        <!--用户个人账户信息-->
        <div class="baseInfoBox">
            <ul>
                <li id="li_UserName"><s:property value="hello"/></li>
                <li id="li_UserNo">学  号：<s:property value="userNo"/></li>
                <li class="last" id="li_LastLoginTime">最后一次登录时间：<s:property value="loginTime"/></li>
            </ul>
        </div> 
        <!--中间分隔线-->
        <div class="splitBox"></div>
        <!--常用银行及账户安全级别信息-->
        <div class="safeInfoBox">
            <ul>
                <li>
                    <label class="txt">我的常用银行</label>
                    <label id="lb_MyBankCount"><s:property value="bankCount"/>家</label>
                    <a href="bank.action" target="_blank" title="设置我的常用银行"><span class="bankSet"></span></a>
                </li>
                <li>
                    <label class="txt">我的安全级别</label>
                    <label class="red" id="lb_MySafeLevel"><s:property value="safeLevel"/>&nbsp;&nbsp;</label>
                    <a href="safe.action" target="_blank" title="手机验证"><span class="safeMobile"></span></a>
                    <a href="safe.action" target="_blank" title="短信验证"><span class="safeMsg"></span></a>
                    <a href="safe.action" target="_blank" title="设置密码"><span class="safePwd"></span></a>
                </li>
            </ul>
        </div>
    </div>
    <!--主内容区域-->
    <div id="wrap">
        <!--一卡通内容区域-->
        <div id="cardBox">
            <!--区域图标-->
            <p class="logo"></p>
            <!--一卡通状态信息区域-->
            <div class="cardInfo">
                <ul>
                    <li>
                    	<span class="sp50"><a href="http://yktxf.scujcc.cn/Default.aspx?studentNo=<s:property value="smartCard"/>" target="_blank">挂失一卡通</a>|<a href="http://yktxf.scujcc.cn/Default.aspx?studentNo=<s:property value="smartCard"/>" target="_blank">消费明细</a></span>
                        <label class="boldInfo">一卡通余额：</label>
                        <label class="boldRedInfo" id="lb_CardMoney"></label>
                        <label class="boldInfo">元</label>
                    </li>
                    <li class="liStatus">
                        <label class="normalInfo">状态：</label>
                        <label class="normalInfo" id="lb_CardStatus"></label>
                        <!-- <label class="normalInfo"><a href="http://yktxf.scujcc.cn/Default.aspx?studentNo=<s:property value="smartCard"/>" target="_blank"><img border="0px" src="/images/card_status.png" alt="挂失一卡通" title="挂失一卡通"></img></a></label>-->　　
                        <!--<label class="status" title="挂失一卡通">
                        <div id="div_LossCard">
                            <input type="text" value="输入一卡通密码进行挂失" name="txt_CardPassword" id="txt_CardPassword" maxlength="16" />
                            <input type="button" value="挂失" name="btn_LossCard" id="btn_LossCard" title="挂失你的一卡通" />
                        </div>-->
                    </li>
                    <li>
                        <label class="normalInfo">卡号：</label>
                        <label class="normalInfo" id="lb_CardNo"></label>
                        <!-- <label class="normalInfo">　　<a href="http://yktxf.scujcc.cn/Default.aspx?studentNo=<s:property value="smartCard"/>" target="_blank">消费明细</a></label>-->
                    </li>
                </ul>
            </div>
            <!--充值卡区域-->
            <div class="payCard">
                <ul>
                    <li class="title">一卡通充值</li>
                    <li class="payCardBox">
                        <input type="button" name="btn_SubmitPay" id="btn_SubmitPay" value="确定" title="确定充值" />
                        <input type="hidden" name="txt_PayValue" id="txt_PayValue" value="0" />
                    </li>
                    <li class="info">
                        <span class="sp3" id="sp_PaidInfoArr"></span>
                        <p class="infoEmpty" id="p_PaidInfo"></p>
                        <!-- <p class="radioBox">
                            <input type="radio" name="radio_PayType" id="radio_PayType_1" value="1" />
                            <label for="radio_PayType_1" title="找朋友、同学帮你充值一卡通">找人代充</label>
                            <input type="radio" name="radio_PayType" id="radio_PayType_2" value="2" />
                            <label for="radio_PayType_2" title="帮朋友、同学充值一卡通">帮人代充</label>
                        </p>-->
                    </li>
                    <li class="fixed"></li>
                </ul>
            </div>
        </div>
        <!--付费项目内容区域-->
        <div id="payforBox">
            <!--区域图标-->
            <p class="logo"></p>    
            <!--缴费项目总数及手续费说明内容区域-->
            <div class="payforItemInfo">
                <ul>
                    <li>
                        <!-- <label class="boldInfo">必交：&nbsp;&nbsp;</label>
                        <label class="boldRedInfo" id="lb_NItemCount"> 0 </label>
                        <label class="boldInfo">&nbsp;&nbsp;项</label>-->
                    </li>
                    <li>
                        <!-- <label class="boldInfo">选交：&nbsp;&nbsp;</label>
                        <label class="boldInfo" id="lb_EItemCount"> 0 </label>
                        <label class="boldInfo">&nbsp;&nbsp;项</label>-->
                        <label class="rightInfo">以下缴费均另收取0.2%的手续费</label>
                    </li>
                </ul>
            </div>
            <!--必交项内容区域-->
            <div class="payforTitle" id="div_NItemTitle">必交项</div>
            <!--选交项内容区域-->
            <div class="empty"></div>
            <div class="empty"></div>
            <div class="empty"></div>
            <div class="payforTitle" id="div_EItemTitle">选交项</div>
            <div class="empty"></div>
            <div class="empty"></div>
            <div class="empty"></div>
        </div>
        <!--历史账单内容区域-->
        <div id="billBox">
            <!--区域图标-->
            <p class="logo"></p>    
            <!--账单选项卡切换区域-->
            <div class="billTabBox">
                <a class="actived" href="javascript:void(0);">最近交易记录</a>
                │
                <a href="javascript:void(0);">一卡通充值记录</a>
                │
                <a href="javascript:void(0);">缴费记录</a>
            </div>
            <div class="empty"></div>
            <div class="billListBox" id="div_billListBox"></div>
            <div class="moreBox">
                <a href="more.action" target="_blank">查看所有交易记录</a><a href="javascript:void(0);">回收站</a>
            </div>
        </div>

        <!--右边浮动内容区域-->
        <div id="rightBox">
            <!--区域图标-->
            <p class="logo"></p>
            <div class="boxTitle">收银台　　　已选择的缴费项目</div>
            <div class="empty"></div>
            <div class="empty"></div>
            <div class="cartItemBox">
                <ul id="ul_cartItemBox">
                </ul>
            </div>
            <div class="cartTotal">
                <ul>
                    <li>
                        <span>共计选择：</span>
                        <span class="money" id="sp_CartItemCount">0</span>
                        <span>项</span>
                    </li>
                    <li>
                        <span>　金额：￥</span>
                        <span class="money" id="sp_CartItemMoney">0</span>
                        <span>元</span>
                    </li>
                    <li>
                        <span>手续费：￥</span>
                        <span class="money" id="sp_CartItemMoney2">0</span>
                        <span>元</span>
                    </li>
                    <li>
                        <span>总金额：￥</span>
                        <span class="money" id="sp_CartItemMoney3">0</span>
                        <span>元</span>
                    </li>
                </ul>
            </div>
            <!-- <div class="recBankTitle" id="div_RecBankTitle">推荐银行</div> -->
            <div class="recBankTitle">常用银行</div>
            <div class="myBankbox" id="div_MyBankBox"></div>
            <!--<div class="recBankTitle">其他银行</div>-->
            <div class="otherBankbox">
                <!-- <input type="radio" value="0" id="radio_Bank_0" name="radio_Bank" />-->
                <label id="lb_Bank_0" for="radio_Bank_0" style="">其他银行</label>
                <select name="sel_OtherBank" id="sel_OtherBank"></select>
            </div>
            <div class="submitbox">
                <input type="button" name="btn_SubmitBank" id="btn_SubmitBank" value="去支付" title="前往支付" />
            </div>
        </div>
    </div>

    <form id="payForm" action="prepay.action" method="post" target="_blank">
    	<input id="orderName" name="orderName" type="hidden" />
    	<input id="orderInfo" name="orderInfo" type="hidden" />
    	<input id="orderDetails" name="orderDetails" type="hidden" />
    	<input id="orderPrice" name="orderPrice" type="hidden" />
    	<input id="orderBank" name="orderBank" type="hidden" />
    </form>
    
    
    <!--底部版权信息-->
    <!--<div id="footer">
        底部版权信息
    </div>-->
    <script type="text/javascript" src="js/footer.js"></script>
</body>
</html>